package com.nbsaas.boot.store.rest.resource;

import com.nbsaas.boot.store.api.apis.StoreApi;
import com.nbsaas.boot.store.data.entity.Store;
import com.nbsaas.boot.store.api.domain.request.StoreRequest;
import com.nbsaas.boot.store.api.domain.response.StoreResponse;
import com.nbsaas.boot.store.api.domain.simple.StoreSimple;
import com.nbsaas.boot.store.rest.convert.StoreSimpleConvert;
import com.nbsaas.boot.store.rest.convert.StoreEntityConvert;
import com.nbsaas.boot.store.rest.convert.StoreResponseConvert;
import com.nbsaas.boot.store.data.repository.StoreRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class StoreResource extends BaseResource<Store,StoreResponse, StoreSimple, StoreRequest>  implements StoreApi {

    @Resource
    private StoreRepository storeRepository;

    @Override
    public JpaRepositoryImplementation<Store, Serializable> getJpaRepository() {
        return storeRepository;
    }

    @Override
    public Function<Store, StoreSimple> getConvertSimple() {
        return new StoreSimpleConvert();
    }

    @Override
    public Function<StoreRequest, Store> getConvertForm() {
        return new StoreEntityConvert();
    }

    @Override
    public Function<Store, StoreResponse> getConvertResponse() {
        return new StoreResponseConvert();
    }




}


